<template>
  <div style="height: 100%;">
    <x-header :left-options="{preventGoBack:true,backText: ''}"
              @on-click-back="backhome">安全教育早会查看</x-header>
    <div class="main-container">
      <!-- <div id="map"></div> -->
      <v-touch v-on:swiperight="onSwipeRight"
               :swipe-options="{direction: 'horizontal'}">
        <div>
          <group>
            <cell title="早会标题"
                  v-model="title"></cell>
            <cell title="项目部"
                  v-model="sysPrjName"></cell>
            <cell title="工程项目"
                  v-model="projectName"></cell>

            <cell title="带班人"
                         v-model="dutyperson"></cell>

            <cell title="参与人"
                     v-model="participants"
                     text-align=right></cell>
            </group>

          <group title="早会视频">
            <picture-upload :pageToken="pageToken"
                            :fieldToken='attachments'
                            v-model="attachments"
                            :readonly='true'
                            type="VIDEO"></picture-upload>
          </group>

          <group title="备注">
            <x-textarea 
                        v-model="remarks"
                        :readonly='true'></x-textarea>
          </group>

          <group >
            <calendar v-model="date"
                      title="早会日期"
                      disable-future
                      readonly="true"
                      ></calendar>
            <cell title="填写人"
                  v-model="inputUserFullName"></cell>
            <cell title="联系电话"
                  v-model="mobile"></cell>
            <cell title="填写部门"
                  v-model="inputUserDeptName"></cell>
            <cell title="填写时间"
                  v-model="inputDate"></cell>
          </group>

        </div>
      </v-touch>
    </div>
  </div>
</template>
 
<script>
import * as L from "leaflet";
//Vue.L = Vue.prototype.$L = L
import {
  Group,
  Cell,
  XButton,
  Box,
  GroupTitle,
  Flexbox,
  FlexboxItem,
  Divider,
  Calendar,
  PopupPicker,
  Toast,
  XInput,
  Picker
} from "vux";
var map = null;
var marker = null;
export default {
  components: {
    XButton,
    Box,
    GroupTitle,
    Group,
    Flexbox,
    FlexboxItem,
    Divider,
    Group,
    Cell,
    Calendar,
    PopupPicker,
    Toast,
    XInput,
    Picker
  },
  name: "HelloWorld",
  data () {
    return {
      GUID:this.$route.query.GUID,
      sysprjID:"",
      sysPrjName: "",
      projectName: this.$route.query.projectName,
      projectName1:"",
      projectId:"",
      inputUserFullName: "",
      userName: "",
      mobile: "",
      inputUserDeptName: "",
      inputUserDeptId: "",
      title:"",
      DESCRIPTION: "",
      pageToken: "",
      attachments: "",
      dutyperson:"",
      participants:"",
      buttonid: "",
      inputDate: "",
      remarks:"",
      date:"",
      month: "",
      year: "",
      toastValue: false,
      toastValueErr: false,
      err: ""
    };
  },
  methods: {
    onSwipeRight () {
      this.$router.push("/safetyMeetingList");
    },

    backhome () {
        this.$router.push({ path: "/safetyMeetingList", query: {   } });
    },
    
  },
  mounted () {

    var greenIcon = L.icon({
      iconUrl: "../src/assets/img/sign-in.png",
      iconSize: [26, 44], // size of the icon
      iconAnchor: [17, 48] // point of the icon which will correspond to marker's location
      //popupAnchor:  [-3, -76] // point from which the popup should open relative to the iconAnchor
    });
    this.pageToken = this.guid(); //this.sPageToken();
    // this.fieldToken = this.guid();
    this.buttonid = this.guid();

    //获取完整信息
    var params = {"_method":"formService.getFormData",
    "requestEventData":{
        "eventType":"formInitEvent",
        "formType":1,
        "bizObjId":"PMMOBILE_DANGEREDUCATION",
        "formId":"PMMOBILE_DANGEREDUCATION_ADD"
        },
        "useType":"view",
        "getData":{
            "useType":"view",
            "objName":"PMMOBILE_DANGEREDUCATION",
            "relatedObj":["PMMOBILE_DANGEREDUCATION"],
            "pk":[{"key":"GUID","value":this.GUID }]
            },
            "getSysVar":{
                "INPUTUSERFULLNAME":"{sysLoginUser.userName}",
                "text_0":"{sysLoginUser.loginId}",
                "MOBILE":"{sysLoginUser.mobil}",
                "TODAY":"{sysDate.Today}",
                "INPUTUSERDEPTNAME":"{sysLoginUser.orgName}",
                "text_1":"{sysLoginUser.orgId}",
                "INPUTDATE":"{sysDate.Today}"},
                "getFormVerify":{"objName":"PMMOBILE_DANGEREDUCATION",
                "viewId":"PMMOBILE_DANGEREDUCATION_ADD"},
                "getToolbar":{
                    "useType":"view",
                    "objName":"PMMOBILE_DANGEREDUCATION",
                    "viewId":"PMMOBILE_DANGEREDUCATION_ADD"
                    }
    };
    let json = {
      FixJSON: JSON.stringify(params),
    };
    this.$ajax({
      // async:false,
      url: this.COMMON_URL,// + "?_isBreak=false&objName=PMMOBILE_DANGEREDUCATION&_useType=view&_pk=GUID&_pkValue=" + this.GUID,
      method: 'post',
      // data: this.signMD5(json)
      data:json
    }).then(res => {
      console.log(res);
      this.sysPrjName = res.data.getData.PMMOBILE_DANGEREDUCATION[0].SYSPRJNAME.val;
      this.ProjectName = res.data.getData.PMMOBILE_DANGEREDUCATION[0].PROJECTNAME.val.substring(0, 10);
      this.inputUserFullName = res.data.getData.PMMOBILE_DANGEREDUCATION[0].INPUTUSERFULLNAME.val.substring(0, 10);
      this.attachments = res.data.getData.PMMOBILE_DANGEREDUCATION[0].ATTACHMENTS.val;
      this.mobile = res.data.getData.PMMOBILE_DANGEREDUCATION[0].MOBILE.val;
      this.inputUserDeptName = res.data.getData.PMMOBILE_DANGEREDUCATION[0].INPUTUSERDEPTNAME.val;
      this.remarks = res.data.getData.PMMOBILE_DANGEREDUCATION[0].REMARKS.val;
      this.inputDate = res.data.getData.PMMOBILE_DANGEREDUCATION[0].INPUTDATE.val.substring(0, 10);
      this.participants = res.data.getData.PMMOBILE_DANGEREDUCATION[0].PARTICIPANTS.val;
      this.dutyperson = res.data.getData.PMMOBILE_DANGEREDUCATION[0].DUTYPERSON.val;
      this.date = res.data.getData.PMMOBILE_DANGEREDUCATION[0].DATE.val.substring(0, 10);
      this.title = res.data.getData.PMMOBILE_DANGEREDUCATION[0].TITLE.val;
  
    });   //then中的参数res是ajax请求返回的响应对象，使用console打印res，f12可在浏览器后台查看响应res的内容，获取相应数据
  },
  watch: {

  }
};
</script>
 
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
/* .transition-view /deep/.weui-cells__title {
      margin-top: 0.77em;
    margin-bottom: 0.3em;
    padding-left: 15px;
    padding-right: 15px;
    color: #353535;
    font-size: 14px;
} */
/* .transition-view /deep/ .vux-header .vux-header-left .left-arrow:before {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.8);
  border-width: 1px 0 0 1px;
  -webkit-transform: rotate(315deg);
  transform: rotate(315deg);
  top: 8px;
  left: 7px;
}
.transition-view /deep/ .vux-header .vux-header-title {
  line-height: 40px;
  text-align: center;
  font-size: 18px;
  font-weight: 400;
  color: #333;
} */

#map {
  width: 100%;
  height: 25%;
}
.content {
  width: 100%;
  height: 75%;
}
</style>